<script src="./test.js"></script>
<script>
  Module.onRuntimeInitialized = async () => {
    const api = {
      version: Module.cwrap("version", "number", []),
    };
    console.log(api.version().toString(16));
    str = api.version().toString(16);
    // 插入点号
    str = str.slice(0, -4) + '.' + str.slice(-4, -2) + '.' + str.slice(-2);

    // 添加 'v' 前缀
    console.log( 'v' + str);
  };
</script>

<script>
async function loadImage(src) {
  // Load image
  const imgBlob = await fetch(src).then((resp) => resp.blob());
  const img = await createImageBitmap(imgBlob);
  // Make canvas same size as image
  const canvas = document.createElement("canvas");
  canvas.width = img.width;
  canvas.height = img.height;
  // Draw image onto canvas
  const ctx = canvas.getContext("2d");
  ctx.drawImage(img, 0, 0);
  return ctx.getImageData(0, 0, img.width, img.height);
}

</script>
